<template>
  <div class="common-layout">
    <el-container>
      <el-header>
        <headerPart />
      </el-header>
      <el-container>
        <el-main><router-view /></el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script lang="ts" setup>
import { ref } from "vue";
import axios from "axios";
import { ElMessage } from "element-plus";
import headerPart from "@/components/IndexComponents/HeaderPart.vue";
import router from "../router";
const checkRoleOfSchool = () => {
  const token = localStorage.getItem("order_auth_token");
  axios
    .get("/api/auth/school/check", {
      headers: {
        token: token,
      },
    })
    .then((res) => {
      // console.log(res);
      if (res.data.success) {
        localStorage.setItem("order_auth_token", res.data.message);
      } else {
        ElMessage({
          message: "权限异常,请重新登陆",
          type: "error",
        });
        router.push("/auth/login");
      }
    })
    .catch((err) => {
      console.log(err);
    });
};

checkRoleOfSchool();
</script>

<style lang="scss" scoped></style>
